package cn.bdqn.controller;

import cn.bdqn.dto.Dto;
import cn.bdqn.service.HotelMessageService;
import cn.bdqn.vo.CommentListVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Controller
public class HotelMessageController {
@Resource
    private HotelMessageService hotelMessageService;

    /**
     *查看酒店周围商圈和特色
     * @param
     * @return
     */
    @ApiOperation(value = "查看酒店周围商圈和特色", httpMethod = "GET",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class, notes = "通过城市id来查询商圈")
    @RequestMapping(value = "/api/hotel/getvideodesc/{hotelId}", method = RequestMethod.GET, produces = "application/json")
    @ResponseBody
    public Dto selectHotelFeatureAndTrade(@PathVariable Integer hotelId){
        Dto dto=new Dto();
        dto=hotelMessageService.selectHotelFeatureAndTrade(hotelId);
        return dto;
    }


    /**
     *查看酒店图片
     * @param
     * @return
     */
    @ApiOperation(value = "查询房间图片", httpMethod = "GET",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class, notes = "通过城市id来查询商圈")
    @RequestMapping(value = "/api/hotelroom/getimg/{roomId}", method = RequestMethod.GET, produces = "application/json")
    @ResponseBody
    public Dto selectRoomImage(@PathVariable Integer roomId){
        Dto dto=new Dto();
        Map map=new HashMap();
        if(roomId==null){
            dto.setCode("10001");
            dto.setMsg("床型不能为空");
            return dto;
        }
        map.put("targetId",roomId);
        dto=hotelMessageService.selectHotelImage(map);
        return dto;
    }


    /**
     *查看酒店政策
     * @param
     * @return
     */
    @ApiOperation(value = "查看酒店政策", httpMethod = "GET",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class, notes = "通过id来查询政策")
    @RequestMapping(value = "/api/hotel/queryhotelpolicy/{hotelId}", method = RequestMethod.GET, produces = "application/json")
    @ResponseBody
    public Dto selectHotelPolicy(@PathVariable Integer hotelId){
        Dto dto=new Dto();
        dto=hotelMessageService.selectHotelPolicy(hotelId);
        return dto;
    }


    /**
     *查看酒店评论
     * @param
     * @return
     */
    @ApiOperation(value = "查看酒店评论", httpMethod = "POST",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class, notes = "")
    @RequestMapping(value = "/api/comment/getcommentlist", method = RequestMethod.POST, produces = "application/json")
    @ResponseBody
    public Dto selectComment(@RequestBody CommentListVO commentListVO){
        Dto dto=new Dto();
        dto=hotelMessageService.selectComment(commentListVO);
        return dto;
    }

    /**
     *获取酒店评论图片
     * @param
     * @return
     */
    @ApiOperation(value = "查看酒店评论", httpMethod = "GET",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class, notes = "评论id来查询评论图片")
    @RequestMapping(value = "/api/comment/getimg/{targetId}", method = RequestMethod.GET, produces = "application/json")
    @ResponseBody
    public Dto selectCommentImg(@PathVariable Integer targetId){
        Dto dto=new Dto();
        dto=hotelMessageService.selectCommentImg(targetId);
        return dto;
    }



    /**
     *查询酒店图片
     * @param
     * @return
     */
    @ApiOperation(value = "查看酒店评论", httpMethod = "GET",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class, notes = "通过酒店Id获得图片")
    @RequestMapping(value = "/api/hotel/getimg/{targetId}", method = RequestMethod.GET, produces = "application/json")
    @ResponseBody
    public Dto selectHotelImg(@PathVariable Integer targetId){
        Dto dto=new Dto();
        dto=hotelMessageService.selectHotelImg(targetId);
        return dto;
    }


}
